//
//  MySecondCell.m
//  AnnCar_user
//
//  Created by LiBenCan on 17/10/23.
//  Copyright © 2017年 LiBenCan. All rights reserved.
//

#import "MySecondCell.h"
#import "smallView.h"
@implementation MySecondCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier])
    {
        self.backgroundColor = backColor;
    }
    return self;
}

- (void)loadCell:(NSArray *)btnArr ImageArr:(NSArray *)imageArr
{
    for (UIView *view in self.contentView.subviews) {
        [view removeFromSuperview];
    }
    //循环创建按钮 我的钱包 我的消费 。。。。
    for (int i = 0; i < 4; i++) {
        float x = (SCREENW/2+1)*(i%2);
        float y = 60*screenW_6*(i/2);
        smallView *btnView = [[smallView alloc]initWithFrame:CGRectMake(x, y, SCREENW/2-0.5,59*screenW_6) Title:btnArr[i] BtnImage:imageArr[i]];
        [self.contentView addSubview:btnView];
        btnView.tag = i;
        btnView.userInteractionEnabled = YES;
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(ViewTap:)];
        [btnView addGestureRecognizer:tap];
    }
}


- (void)ViewTap:(UITapGestureRecognizer *)tap//按钮点击事件
{
    if (_selectBlock) {//存在则点击回调
        _selectBlock(tap.view.tag);
    }
}

@end
